package cc.facesign.common.exception;

import cc.facesign.common.utils.bean.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalException {

    @ExceptionHandler(FacesignException.class)
    @ResponseBody
    public R facesignException(FacesignException e) {
        e.printStackTrace();
        return R.error()
                .message("Facesign异常")
                .data(e.getClass()+"", e.getMessage());
    }

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public R globalException(Exception e) {
        e.printStackTrace();
        return R.error().message("全局异常").data(e.getClass()+"", e.getMessage());
    }
}
